<?php

namespace app\admin\controller\contents;
use app\admin\controller\general\Config;
use app\common\controller\Backend;

class Kefu extends Backend
{
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 查看
     */
    public function index()
    {
        $info=Model("kefu")->where(array('id'=>1))->find();
        $this->view->assign('info', $info);
        return $this->view->fetch();
    }

    public function update()
    {
        if ($this->request->isPost()) {
            $this->token();
            $params = $this->request->post("row/a");
            $params = array_filter(array_intersect_key(
                $params,
                array_flip(array('id','kefu_400', 'kefu_weixin', 'kefu_about'))
            ));
            unset($v);
            if ($params) {
                Model('kefu')->where(array('id'=>1))->update($params);
                $this->success();
            }
            $this->error();
        }
        return;
    }
}
